<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<%@taglib prefix="mvc" uri="http://www.springframework.org/tags/form" %>
<%@taglib prefix="fmt" uri="http://www.springframework.org/tags" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <title>考勤设置</title>
    <%--<link rel="stylesheet" type="text/css" href="../lib/laydate.css"/>--%>
    <link rel="stylesheet" type="text/css" href="../lib/pagination/style/pagination.css"/>
    <link rel="stylesheet" type="text/css" href="../css/base.css"/>
    <link rel="stylesheet" type="text/css" href="../css/attend/laydate.css"/>

    <script type="text/javascript" src="../js/common/language.js" ></script>
    <script type="text/javascript" src="../js/news/jquery-1.9.1.js"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.ui.widget.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.iframe-transport.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jQuery-File-Upload-master/jquery.fileupload.js" type="text/javascript" charset="utf-8"></script>
    <%--<script src="../js/news/page.js"></script>--%>
    <%--<script src="../lib/laydate.js"></script>--%>
    <script src="../js/attend/laydate.js"></script>
    <script src="../js/base/base.js" type="text/javascript" charset="utf-8"></script>
    <script src="/js/ajaxupload.js" type="text/javascript" charset="utf-8"></script>
    <script src="/lib/jquery.form.min.js"></script>
    <script src="../lib/pagination/js/jquery.pagination.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../lib/layer/layer.js?20201106"></script>
    <script src="../js/jquery/jquery.cookie.js"></script>

    <style>
        a{
            text-decoration: none;
            color: #207bd6;
        }
        .buttonDiv{
            width: 100%;
        }
        .buttonDiv>div{
            float: left;
            margin: 20px 10px;
        }
        .buttonDiv .deleteBtn{
            width: 99px;
            height: 28px;
            /*margin: 20px auto;*/
            background: url("../img/btn_deletecontent_03.png") no-repeat;
            line-height: 28px;
            cursor: pointer;
        }
        .buttonDiv .exportDiv{
            width: 99px;
            height: 28px;
            /*margin: 20px auto;*/
            background: url("../img/icon_daoru.png") no-repeat;
            line-height: 28px;
            cursor: pointer;
        }
        .fileDone select{
            width: 160px;
            height:28px;
        }
        #tr_td tr:nth-child(odd){
            background-color: #fff;
        }

        input{
            float: none;
        }
        .newMange input[type="text"]{
            width: 260px;
            height: 30px;
        }
        select{
            width: 260px;
            height: 30px;
        }
        textarea{
            width: 260px;
            height: 50px;
            vertical-align: middle;
        }
        a{
            text-decoration: none;
            color: #207bd6;
        }
        .newTbale tr td{
            border-right: #ccc 1px solid;
            padding: 5px;
        }
        .divBtn{
            float: right;
            width: 90px;
            height: 28px;
            background: #2b7fe0;
            color: #fff;
            font-size: 14px;
            line-height: 28px;
            margin-right: 4%;
            margin-top: 20px;
            cursor: pointer;
            border-radius: 4px;
        }
        .divTable{
            width: 90%;
            margin: 0px auto;
        }
        .divTable table{
            width: 100%;
        }
        .divTable table tr th{
            padding: 8px;
            font-size: 13pt;
            color: #2F5C8F;
        }
        td{
            font-size: 11pt;
        }
        .divTable table tr td{
            text-align: center;
        }
        .newPage{
            width: 80%;
            margin: 0 auto;
        }
        .newPage table{
            width: 100%;
        }
        .newPage table tr td{
            text-align: left;
        }
        .newPage table tr td input[type="text"]{
            width: 200px;
            height: 30px;
            border-radius: 4px;
            font-size: 11pt;
            padding-left: 5px;
        }
        .newPage table tr td input[type="radio"]{
            width: 16px;
            margin: -1px;
        }
        .newPage table tr td input[type="checkbox"]{
            width: 16px;
            margin: -1px;
        }
        .qiandao{
            /*font-size: 11pt;*/
            font-size: 13pt;
            font-weight: bold;
         }
        .btnBox{
            width: 100%;
            margin-bottom: 20px;
        }
        .btnBox .btn{
            width: 100px;
            height: 30px;
            margin: 0 auto;
        }
        .btnBox .btn div{
            float: left;
            width: 40px;
            height: 28px;
            background: #2b7fe0;
            border-radius: 4px;
            cursor: pointer;
            text-align: center;
            color: #ffffff;
            line-height: 28px;
        }
        .saveBtn{
            margin-right: 10px;
        }
    </style>

</head>

<body style="background: white">
<div class="bx">
    <div class="navigation  clearfix juMange" id="atSet" style="display: block;">
        <div class="left" style="margin-left: 30px">
            <img src="/img/commonTheme/${sessionScope.InterfaceModel}/icon_manageFile.png">
            <div class="news">考勤记录</div>
        </div>
  <%--      <div class="divBtn">
            <img src="../../img/mywork/newbuildworjk.png" alt="" style="margin-left: 6px;margin-top: -4px;">
            <span style="font-size: 11pt;">设置考勤</span>
        </div>--%>
    </div>
    <div class="divTable" style="display: block;">
        <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
            <thead>
            <tr>
                <th>类型名称</th>
                <th>第一次签到时间</th>
                <th>第二次签到时间</th>
                <th>第三次签到时间</th>
                <th>第四次签到时间</th>
                <th>第五次签到时间</th>
                <th>第六次签到时间</th>
                <th>是否开启WiFi</th>
                <th>是否开启外勤</th>
               <%-- <th>操作</th>--%>
            </tr>
            </thead>
            <tbody id="trList">

            </tbody>
        </table>
        <div class="right">
            <!-- 分页按钮-->
            <div class="M-box3" id="dbgz_page"></div>
        </div>
    </div>
    <div class="newPage" style="display: none;">
        <form id="form1" action="/attendSet/newAttendSet">
            <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse">
                <tr>
                    <td style="width: 80px;">类型名称：</td>
                    <td colspan="5"><input type="text" name="title"></td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;"><span class="qiandao">第一次签到</span></td>
                </tr>
                <tr>
                    <td style="width: 80px;">是否开启：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="atime1Setother" value="1">
                            <span style="margin-right: 13px;">是</span>
                        </label>
                        <label for="">
                            <input type="radio" name="atime1Setother" value="0" checked>
                            <span>否</span>
                        </label>
                    </td>
                    <td style="width: 60px;">类型：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="commute1" value="1" checked>
                            <span style="margin-right: 13px;">上班</span>
                        </label>
                        <label for="">
                            <input type="radio" name="commute1" value="2">
                            <span>下班</span>
                        </label>
                    </td>
                    <td style="width: 60px;">时间：</td>
                    <td><input type="text" name="atime1" class="time_1" readonly></td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;"><span class="qiandao">第二次签到</span></td>
                </tr>
                <tr>
                    <td style="width: 80px;">是否开启：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="atime2Setother" value="1">
                            <span style="margin-right: 13px;">是</span>
                        </label>
                        <label for="">
                            <input type="radio" name="atime2Setother" value="0" checked>
                            <span>否</span>
                        </label>
                    </td>
                    <td style="width: 60px;">类型：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="commute2" value="1" checked>
                            <span style="margin-right: 13px;">上班</span>
                        </label>
                        <label for="">
                            <input type="radio" name="commute2" value="2">
                            <span>下班</span>
                        </label>
                    </td>
                    <td style="width: 60px;">时间：</td>
                    <td><input type="text" name="atime2" class="time_2" readonly></td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;"><span class="qiandao">第三次签到</span></td>
                </tr>
                <tr>
                    <td style="width: 80px;">是否开启：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="atime3Setother" value="1">
                            <span style="margin-right: 13px;">是</span>
                        </label>
                        <label for="">
                            <input type="radio" name="atime3Setother" value="0" checked>
                            <span>否</span>
                        </label>
                    </td>
                    <td style="width: 60px;">类型：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="commute3" value="1" checked>
                            <span style="margin-right: 13px;">上班</span>
                        </label>
                        <label for="">
                            <input type="radio" name="commute3" value="2">
                            <span>下班</span>
                        </label>
                    </td>
                    <td style="width: 60px;">时间：</td>
                    <td><input type="text" name="atime3" class="time_3" readonly></td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;"><span class="qiandao">第四次签到</span></td>
                </tr>
                <tr>
                    <td style="width: 80px;">是否开启：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="atime4Setother" value="1">
                            <span style="margin-right: 13px;">是</span>
                        </label>
                        <label for="">
                            <input type="radio" name="atime4Setother" value="0" checked>
                            <span>否</span>
                        </label>
                    </td>
                    <td style="width: 60px;">类型：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="commute4" value="1" checked>
                            <span style="margin-right: 13px;">上班</span>
                        </label>
                        <label for="">
                            <input type="radio" name="commute4" value="2">
                            <span>下班</span>
                        </label>
                    </td>
                    <td style="width: 60px;">时间：</td>
                    <td><input type="text" name="atime4" class="time_4" readonly></td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;"><span class="qiandao">第五次签到</span></td>
                </tr>
                <tr>
                    <td style="width: 80px;">是否开启：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="atime5Setother" value="1">
                            <span style="margin-right: 13px;">是</span>
                        </label>
                        <label for="">
                            <input type="radio" name="atime5Setother" value="0" checked>
                            <span>否</span>
                        </label>
                    </td>
                    <td style="width: 60px;">类型：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="commute5" value="1" checked>
                            <span style="margin-right: 13px;">上班</span>
                        </label>
                        <label for="">
                            <input type="radio" name="commute5" value="2">
                            <span>下班</span>
                        </label>
                    </td>
                    <td style="width: 60px;">时间：</td>
                    <td><input type="text" name="atime5" class="time_5" readonly></td>
                </tr>
                <tr>
                    <td colspan="6" style="text-align: center;"><span class="qiandao">第六次签到</span></td>
                </tr>
                <tr>
                    <td style="width: 80px;">是否开启：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="atime6Setother" value="1">
                            <span style="margin-right: 13px;">是</span>
                        </label>
                        <label for="">
                            <input type="radio" name="atime6Setother" value="0" checked>
                            <span>否</span>
                        </label>
                    </td>
                    <td style="width: 60px;">类型：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="commute6" value="1" checked>
                            <span style="margin-right: 13px;">上班</span>
                        </label>
                        <label for="">
                            <input type="radio" name="commute6" value="2">
                            <span>下班</span>
                        </label>
                    </td>
                    <td style="width: 60px;">时间：</td>
                    <td><input type="text" name="atime6" class="time_6" readonly></td>
                </tr>
            </table>
            <table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse;margin-bottom: 20px;">
                <tr style="border-top: none;">
                    <td colspan="3" style="text-align: center;"><span class="qiandao">上下班签到设置</span></td>
                </tr>
                <tr>
                    <td style="width: 180px;">允许上班提前签到时间：</td>
                    <td colspan="2"><input type="text" name="worktimeF" class="time_7" readonly></td>
                </tr>
                <tr>
                    <td style="width: 180px;">允许上班延后签到时间：</td>
                    <td colspan="2"><input type="text" name="worktimeB" class="time_8" readonly></td>
                </tr>
                <tr>
                    <td style="width: 180px;">允许下班提前签到时间：</td>
                    <td colspan="2"><input type="text" name="workafterF" class="time_9" readonly></td>
                </tr>
                <tr>
                    <td style="width: 180px;">允许下班延后签到时间：</td>
                    <td colspan="2"><input type="text" name="workafterB" class="time_10" readonly></td>
                </tr>
                <tr>
                    <td>位置：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="locationOn" value="1">
                            <span style="margin-right: 13px;">开启</span>
                        </label>
                        <label for="">
                            <input type="radio" name="locationOn" value="0" checked>
                            <span>关闭</span>
                        </label>
                    </td>
                    <td><input type="text" name="location" id="inLocation"></td>
                </tr>
                <tr>
                    <td>范围：</td>
                    <td colspan="2">
                        <select name="ranges" id="ranges" style="width: 100px;">
                            <option value="0">0</option>
                            <option value="10">10</option>
                            <option value="20">20</option>
                            <option value="30">30</option>
                            <option value="40">40</option>
                            <option value="50">50</option>
                            <option value="100">100</option>
                            <option value="200">200</option>
                            <option value="300">300</option>
                            <option value="400">400</option>
                            <option value="500">500</option>
                            <option value="600">600</option>
                            <option value="700">700</option>
                            <option value="800">800</option>
                            <option value="900">900</option>
                            <option value="1000">1000</option>
                        </select>
                    </td>
                </tr>
                <tr><td colspan="3" style="text-align: center;"><span class="qiandao">WIFI签到设置</span></td></tr>
                <tr>
                    <td>是否开启WiFi签到：</td>
                    <td>
                        <label for="">
                            <input type="radio" name="wifiOn" value="1">
                            <span style="margin-right: 13px;">开启</span>
                        </label>
                        <label for="">
                            <input type="radio" name="wifiOn" value="0" checked>
                            <span>关闭</span>
                        </label>
                    </td>
                    <td colspan=""><span>启用Wi-Fi签到后，则不会限制考勤地点和范围</span></td>
                </tr>
                <%--<tr>--%>
                    <%--<td>考勤WI-FI：</td>--%>
                    <%--<td colspan="2"><a href="javascript:;">尚未选择任何WI-FI</a></td>--%>
                <%--</tr>--%>
                <tr><td colspan="3" style="text-align: center;"><span class="qiandao">外勤签到设置</span></td></tr>
                <tr>
                    <td>是否开启外勤：</td>
                    <td colspan="2">
                        <label for="">
                            <input type="radio" name="isOut" value="1">
                            <span style="margin-right: 13px;">是</span>
                        </label>
                        <label for="">
                            <input type="radio" name="isOut" value="0" checked>
                            <span>否</span>
                        </label>
                    </td>
                </tr>
                <tr><td colspan="3" style="text-align: center;"><span class="qiandao">其它考勤设置</span></td></tr>
                <tr>
                    <td>是否开启加班：</td>
                    <td colspan="2">
                        <label for="">
                            <input type="radio" name="isOvertime" value="1" checked>
                            <span style="margin-right: 13px;">是</span>
                        </label>
                        <label for="">
                            <input type="radio" name="isOvertime" value="0" >
                            <span>否</span>
                        </label>
                    </td>
                </tr>
                <tr>
                    <td>是否开启值班：</td>
                    <td colspan="2">
                        <label for="">
                            <input type="radio" name="isDuty" value="1" checked>
                            <span style="margin-right: 13px;">是</span>
                        </label>
                        <label for="">
                            <input type="radio" name="isDuty" value="0">
                            <span>否</span>
                        </label>
                    </td>
                </tr>
                <tr>
                    <td>是否开启出差：</td>
                    <td colspan="2">
                        <label for="">
                            <input type="radio" name="isTrip" value="1" checked>
                            <span style="margin-right: 13px;">是</span>
                        </label>
                        <label for="">
                            <input type="radio" name="isTrip" value="0">
                            <span>否</span>
                        </label>
                    </td>
                </tr>
                <tr>
                    <td>是否开启请假：</td>
                    <td colspan="2">
                        <label for="">
                            <input type="radio" name="isLeave" value="1" checked>
                            <span style="margin-right: 13px;">是</span>
                        </label>
                        <label for="">
                            <input type="radio" name="isLeave" value="0">
                            <span>否</span>
                        </label>
                    </td>
                </tr>
                <tr>
                    <td>是否开启外出：</td>
                    <td colspan="2">
                        <label for="">
                            <input type="radio" name="isGo" value="1" checked>
                            <span style="margin-right: 13px;">是</span>
                        </label>
                        <label for="">
                            <input type="radio" name="isGo" value="0">
                            <span>否</span>
                        </label>
                    </td>
                </tr>
                <tr><td colspan="3" style="text-align: center;"><span class="qiandao">考勤日期设置</span></td></tr>
                <tr>
                    <td>考勤日期：</td>
                    <td colspan="2">
                        <span style="margin-left: 15px;">星期一</span>
                        <input type="checkbox" class="workDay" value="1">
                        <span style="margin-left: 15px;">星期二</span>
                        <input type="checkbox" class="workDay" value="2">
                        <span style="margin-left: 15px;">星期三</span>
                        <input type="checkbox" class="workDay" value="3">
                        <span style="margin-left: 15px;">星期四</span>
                        <input type="checkbox" class="workDay" value="4">
                        <span style="margin-left: 15px;">星期五</span>
                        <input type="checkbox" class="workDay" value="5">
                        <span style="margin-left: 15px;">星期六</span>
                        <input type="checkbox" class="workDay" value="6">
                        <span style="margin-left: 15px;">星期日</span>
                        <input type="checkbox" class="workDay" value="7">
                    </td>
                </tr>
            </table>
        </form>
        <div class="btnBox">
            <div class="btn">
                <div class="saveBtn" btnType="">保存</div>
                <div class="backBtn">返回</div>
            </div>
        </div>
    </div>
</div>
<%--<div class="left" style="margin-top: 30px;margin-left: 30px">
    <img src="/img/commonTheme/${sessionScope.InterfaceModel}/icon_manageFile.png"><span style="font-size: 20px;color: black">  考勤统计</span>
    <table style="width: 92%;margin-left: 32px">
        <tr class="borderNone">
            <td width="30%" class="color">考勤统计：</td>
            <td width="70%">
                起始时间：
                <input type="text" id="startTime" style="width: 158px;height:28px;" name="startTime" size="12" maxlength="10" class="BigInput" value="" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"/>
                截至日期：
                <input type="text" id="endTime" style="width: 158px;height:28px;" name="endTime" size="12" maxlength="10" class="BigInput" value="" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})"/>
                <button style="width:50px;height: 30px;">查询</button>
            </td>
        </tr>
    </table>
</div>--%>
<script src="../js/attend/attendSetting.js"></script>
<script type="text/javascript">
    $(function () {
        var userId=$.cookie('uid');
        $('.divBtn').click(function () {
            $('.newPage').show();
            $('.divTable').hide();
            $('.divBtn').hide();
            $('.saveBtn').attr('btnType','0')
        })
        $('.backBtn').click(function () {
            $('.newPage').hide();
            $('.divTable').show();
            $('.divBtn').show();
            $('#form1')[0].reset();
        })
        dataInit($('#trList'));

        var attendOne=$('input[name="atime1Setother"]:checked').val();
        var attendTwo=$('input[name="atime2Setother"]:checked').val();
        var attendThr=$('input[name="atime3Setother"]:checked').val();
        var attendFour=$('input[name="atime4Setother"]:checked').val();
        var attendFiv=$('input[name="atime5Setother"]:checked').val();
        var attendSix=$('input[name="atime6Setother"]:checked').val();

//        $('input[name="atime1Setother"]').change(function () {
//            var attendOne=$(this).val();
//            if(attendOne == '0'){
//                $('input[name="atime1"]').removeClass('time_1');
//                $('input[name="atime1"]').removeAttr('lay-key');
//            }else {
//                $('input[name="atime1"]').addClass('time_1');
//                laydate.render({
//                    elem: '.time_1',
//                    type: 'time'
//                });
//            }
//        })


        $('.saveBtn').click(function () {
            var btnType=$(this).attr('btnType');
            var inputVal=''
            $('.workDay:checked').each(function () {
                inputVal+=$(this).val()+',';
            })
            var data;
            var tipText='';
            var errorText='';
            if(btnType == '0'){
                $('#form1').attr('action','/attendSet/newAttendSet');
                tipText='新建成功！';
                errorText='新建失败！';
                data={
                    workdate:inputVal,
                    uid:userId,
                    wifiAddr:'',
                    wifiName:''
                }
            }else {
                $('#form1').attr('action','/attendSet/updateAttendSet');
                tipText='修改成功！';
                errorText='修改失败！';
                var sId=$('.saveBtn').attr('sid')
                data={
                    sid:sId,
                    workdate:inputVal,
                    uid:userId,
                    wifiAddr:'',
                    wifiName:''
                }
            }
            $('#form1').ajaxSubmit({
                type: 'post',
                dataType: 'json',
                data:data,
                success: function(res) {
                    if(res.flag){
                        $.layerMsg({content:tipText,icon:1});
                        dataInit($('#trList'));
                        $('.newPage').hide();
                        $('.divTable').show();
                        $('.divBtn').show();
                        $('#form1')[0].reset();
                    }else {
                        $.layerMsg({content:errorText,icon:1});
                    }
                }
            })
        })

//        编辑
        $('#trList').on('click','.editData',function () {
            $('.saveBtn').attr('btnType','1')
            $('.newPage').show();
            $('.divTable').hide();
            $('.divBtn').hide();
            var hoId=$(this).parents('tr').attr('data-id');
            $('.saveBtn').attr('sid',hoId);
            $.ajax({
                type:'get',
                url:'/hr/getHumanResourcesData',
                dataType:'json',
                data:{
                    sid:hoId,
                    typeId:15
                },
                success:function (res) {
                    var datas=res.data;
//                    $('input[type="radio"]').attr("checked",false);

                    $('input[name="title"]').val(datas.title);
                    $('input[name="commute1"][value="'+datas.commute1+'"]').prop("checked",true);
                    $('input[name="commute2"][value="'+datas.commute2+'"]').prop("checked",true);
                    $('input[name="commute3"][value="'+datas.commute3+'"]').prop("checked",true);
                    $('input[name="commute4"][value="'+datas.commute4+'"]').prop("checked",true);
                    $('input[name="commute5"][value="'+datas.commute5+'"]').prop("checked",true);
                    $('input[name="commute6"][value="'+datas.commute6+'"]').prop("checked",true);
                    $('input[name="atime1Setother"][value="'+datas.atime1Setother+'"]').prop("checked",true);
                    $('input[name="atime2Setother"][value="'+datas.atime2Setother+'"]').prop("checked",true);
                    $('input[name="atime3Setother"][value="'+datas.atime3Setother+'"]').prop("checked",true);
                    $('input[name="atime4Setother"][value="'+datas.atime4Setother+'"]').prop("checked",true);
                    $('input[name="atime5Setother"][value="'+datas.atime5Setother+'"]').prop("checked",true);
                    $('input[name="atime6Setother"][value="'+datas.atime6Setother+'"]').prop("checked",true);
                    $('input[name="atime1"]').val(datas.atime1);
                    $('input[name="atime2"]').val(datas.atime2);
                    $('input[name="atime3"]').val(datas.atime3);
                    $('input[name="atime4"]').val(datas.atime4);
                    $('input[name="atime5"]').val(datas.atime5);
                    $('input[name="atime6"]').val(datas.atime6);
                    $('input[name="worktimeF"]').val(datas.worktimeF);
                    $('input[name="worktimeB"]').val(datas.worktimeB);
                    $('input[name="workafterF"]').val(datas.workafterF);
                    $('input[name="workafterB"]').val(datas.workafterB);
                    $('input[name="locationOn"][value="'+datas.locationOn+'"]').prop("checked",true);
                    $('input[name="location"]').val(datas.location);
                    $('#ranges').val(datas.ranges);
                    $('input[name="wifiOn"][value="'+datas.wifiOn+'"]').prop("checked",true);
                    $('input[name="isOut"][value="'+datas.isOut+'"]').prop("checked",true);
                    $('input[name="isOvertime"][value="'+datas.isOvertime+'"]').prop("checked",true);
                    $('input[name="isDuty"][value="'+datas.isDuty+'"]').prop("checked",true);

                    $('input[name="isTrip"][value="'+datas.isTrip+'"]').prop("checked",true);
                    $('input[name="isLeave"][value="'+datas.isLeave+'"]').prop("checked",true);
                    $('input[name="isGo"][value="'+datas.isGo+'"]').prop("checked",true);

                    var arr=datas.workdate.split(',');
//                    console.log(arr);
                    for(var i=0;i<arr.length;i++){
                        $('input.workDay[value="'+arr[i]+'"]').prop("checked",true);
                    }
                }
            })
        })

        //        删除
        $('#trList').on('click','.deleteData',function () {
            var hoId=$(this).parents('tr').attr('data-id');
            layer.confirm('确定要删除吗？', {
                btn: ['确定','取消'] //按钮
            }, function(index){
                $.ajax({
                    type:'post',
                    url:'/attendSet/delAttendSetbyId',
                    dataType:'json',
                    data:{sid:hoId},
                    success:function (res) {
                        if(res.flag){
                            layer.msg('删除成功！', {icon: 1,time:1000});
                            layer.close(index);
                            dataInit($('#trList'));
                        }else{
                            layer.msg('删除失败！', {icon: 2,time:1000});
                            layer.close(index);
                        }
                    }
                })
            }, function(index){
                layer.closeAll();
            });
        })

//        点击位置
        $('#inLocation').click(function () {
            window.open('/attendSet/attendMap');
        })

    })
    function dataInit(element) {

        $.ajax({
            type:'get',
            url:'/selfhelpInquiry/getHumanResourcesData',
            dataType:'json',
            data:{
                typeId:14
            },
            success:function (res) {
                var datas=res.data;
                var str='';
                if(res.flag){
                    for(var i=0;i<datas.length;i++){
                        str+='<tr data-id="'+datas[i].sid+'">' +
                            '<td>'+datas[i].title+'</td>' +
                            '<td>'+datas[i].atime1+'</td>' +
                            '<td>'+datas[i].atime2+'</td>' +
                            '<td>'+datas[i].atime3+'</td>' +
                            '<td>'+datas[i].atime4+'</td>' +
                            '<td>'+datas[i].atime5+'</td>' +
                            '<td>'+datas[i].atime6+'</td>' +
                            '<td>'+function () {
                               if(datas[i].wifiOn == '1'){
                                   return '开启';
                               }else{
                                   return '关闭';
                               }
                            }()+'</td>' +
                            '<td>'+function () {
                               if(datas[i].isOut == '1'){
                                   return '开启';
                               }else {
                                   return '关闭';
                               }
                            }()
                    }
                    element.html(str)
                }
            }
        })
    }
</script>
</body>
</html>
